home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / doc / sigprc08 < prev    next >
Text File  |  1997-07-08  |  800b  |  24 lines

  1. ; This batch file creates a plot of the power spectrum of 
  2. ; the simulated signal used in the example from Chapter 13,
  3. ; "Signal Processing", of _Using IDL_, with a 30 cycle/second
  4. ; periodic component added.
  5.  
  6. @sigprc01.bat ; compute time data sequence u
  7.  
  8. F = FINDGEN(N/2+1) / (N*delt) ; f = [0.0, 1.0/(N*delt), ... , 1.0/(2.0*delt)]
  9.  
  10. u_a = U + SIN(2*!PI*30.0*delt*FINDGEN(N))
  11.  
  12. v_a = FFT(u_a)
  13.  
  14. ; log-log plot of power spectrum
  15.  
  16. PLOT, F, ABS(v_a(0:N/2))^2, YTITLE='Power Spectrum', $
  17.     /YLOG, YRANGE=[1.0e-8,1.0], YSTYLE=1, YMARGIN=[4,4], $
  18.     XTITLE='Frequency in cycles / second', $
  19.     /XLOG, XRANGE=[1.0,1.0/(2.0*delt)], XSTYLE=1, $
  20.     TITLE='Power Spectrum with (solid) and without!C(dashed) Aliased 30 c/s Component'
  21.  
  22. OPLOT, F, ABS((FFT(U))(0:N/2))^2, LINESTYLE=2 ; overplot without window
  23.  
  24.